// 引入request
import { request } from "../../request/index";

Page({
  data: {
    // 轮播图数据
    swiperList: [],
    // 导航数据
    catesList: [],
    // 楼层数据
    floorList: [],
  },
  onLoad() {
    this.getSwiperList();
    this.getCateLiat();
    this.getFoorList()
    // wx.request({
    //   url: 'https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata',
    //   success: (res)=> {
    //     console.log(res);
    //     this.setData({
    //       swiperList:res.data.message
    //     })
    //   }
    // })
  },
  getSwiperList() {
    request({
      url: "/home/swiperdata",
    }).then((res) => {
      this.setData({
        swiperList: res
      });
    });
  },
  getCateLiat() {
    request({
      url: "/home/catitems",
    }).then((res) => {
      this.setData({
        catesList: res
      });
    });
  },
  getFoorList(){
    request({
      url: "/home/floordata",
    }).then((res) => {
      this.setData({
        floorList: res
      });
    });
  }
});
